<!DOCTYPE html>
<html lang="zh"xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
    <title>首页 - 天才(genius)后台管理系统</title>
    <link rel="icon" th:href="@{favicon.ico}" type="image/ico">
    <link href="css/bootstrap.min.css" th:href="@{~/css/bootstrap.min.css}" rel="stylesheet">
    <link href="css/materialdesignicons.min.css" th:href="@{~/css/materialdesignicons.min.css}" rel="stylesheet">
    <link href="css/style.min.css" th:href="@{~/css/style.min.css}" rel="stylesheet">
    <link rel="stylesheet" th:href="@{~/js/jconfirm/jquery-confirm.min.css}" href="js/jconfirm/jquery-confirm.min.css">
</head>
<body>
<div class="lyear-layout-web">
    <div class="lyear-layout-container">
        <!--左侧导航-->
        <aside th:include="left :: common" class="lyear-layout-sidebar">
        </aside>
        <!--End 左侧导航-->

        <!--头部信息-->
        <header th:include="head :: common" class="lyear-layout-header">
        </header>
        <!--End 头部信息-->

        <!--页面主要内容-->
        <main class="lyear-layout-content">
            <a href="/study-course/add"><button class="btn btn-success btn-w-md" type="button">新增课程</button></a>

            <form id="biao" action="/study-course/list">
                <div th:include="study_pageing_head::common"></div>
            </form>

            <table class="table">
                <thead>
                <tr>
                    <th>编号</th>
                    <th>课程名称</th>
                    <th>课程状态</th>
                    <th>课程类型</th>
                    <th>部门名称</th>
                    <th>创建人</th>
                    <th>创建时间</th>
                    <th>修改人</th>
                    <th>修改时间</th>
                    <th>课程路径</th>

                    <th>操作</th>
                </tr>
                </thead>
                <tr th:each="list:${pInfo.list}" >
                <!--<tr th:class="${list.deleted!=1?'active':'success'}">-->
                <!--<tr th:class="${list.courseTypeId!=1?'active':'success'}">-->
                    <td th:text="${list.id}"></td>
                    <td th:text="${list.courseName}"></td>

                    <div th:switch="${list.deleted}">
                        <th th:case="1" style="color:green">未删除</th>
                        <th th:case="2" style="color:red">已删除</th>
                    </div>
                <div th:switch="${list.courseTypeId}">
                    <th th:case="1">必修</th>
                    <th th:case="2">选修</th>
                </div>

                    <td th:text="${list.c1}"></td>
                    <td th:text="${list.a1}"></td>
                    <td th:text="${#dates.format(list.createTime, 'yyyy-MM-dd HH:mm')}"></td>
                    <td th:text="${list.b1}"></td>
                    <td th:text="${#dates.format(list.modifiedTime, 'yyyy-MM-dd HH:mm')}"></td>
                    <td><img th:src="${list.picPath}"th:width="100"height="70"></td>

                    <td th:if="${list.deleted==1}">
                        <div class="btn-group">
                            <a class="btn btn-xs btn-default" th:href="@{/study-course/upd(id=${list.id})}" title="编辑" data-toggle="tooltip"><i class="mdi mdi-pencil"></i></a>
                            <a class="btn btn-xs btn-default"  th:onclick="del([[${list.id}]])" title="删除" data-toggle="tooltip"><i class="mdi mdi-window-close"></i></a>
                        </div>
                    </td>
                </tr>

                </tbody>
            </table>


            <nav th:include="study_paging :: common">

            </nav>


        </main>
        <!--End 页面主要内容-->
    </div>
</div>

<script type="text/javascript" th:src="@{~/js/jquery.min.js}" src="js/jquery.min.js"></script>
<script type="text/javascript" th:src="@{~/js/bootstrap.min.js}" src="js/bootstrap.min.js"></script>
<script type="text/javascript" th:src="@{~/js/perfect-scrollbar.min.js}" src="js/perfect-scrollbar.min.js"></script>
<script type="text/javascript" th:src="@{~/js/main.min.js}" src="js/main.min.js"></script>
<script  th:src="@{~/js/jconfirm/jquery-confirm.min.js}" src="js/jconfirm/jquery-confirm.min.js"></script>
<!--图表插件-->
<script type="text/javascript" th:src="@{~/js/Chart.js}" src="js/Chart.js"></script>
<script type="text/javascript">
    function del(id) {
        $.confirm({
            title: '课程管理删除',
            content: '你确定要删除吗？',
            type: 'red',
            typeAnimated: true,
            buttons: {
                tryAgain: {
                    text: '确定',
                    btnClass: 'btn-red',
                    action: function(){
                        $.ajax({
                            url:"/study-course/del?id="+id
                        });
                        location.href="/study-course/list";

                    }
                },
                close: {
                    text: '关闭'
                }
            }
        });
    }

    function ym(pn,isLastPage){
        if(pn==0){
            return
        }
        $("#pn").attr("value", pn);
        $("#biao").submit();

    }
    $(document).ready(function(e) {
        var $dashChartBarsCnt  = jQuery( '.js-chartjs-bars' )[0].getContext( '2d' ),
            $dashChartLinesCnt = jQuery( '.js-chartjs-lines' )[0].getContext( '2d' );

        var $dashChartBarsData = {
            labels: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
            datasets: [
                {
                    label: '注册用户',
                    borderWidth: 1,
                    borderColor: 'rgba(0,0,0,0)',
                    backgroundColor: 'rgba(51,202,185,0.5)',
                    hoverBackgroundColor: "rgba(51,202,185,0.7)",
                    hoverBorderColor: "rgba(0,0,0,0)",
                    data: [2500, 1500, 1200, 3200, 4800, 3500, 1500]
                }
            ]
        };
        var $dashChartLinesData = {
            labels: ['2003', '2004', '2005', '2006', '2007', '2008', '2009', '2010', '2011', '2012', '2013', '2014'],
            datasets: [
                {
                    label: '交易资金',
                    data: [20, 25, 40, 30, 45, 40, 55, 40, 48, 40, 42, 50],
                    borderColor: '#358ed7',
                    backgroundColor: 'rgba(53, 142, 215, 0.175)',
                    borderWidth: 1,
                    fill: false,
                    lineTension: 0.5
                }
            ]
        };

        new Chart($dashChartBarsCnt, {
            type: 'bar',
            data: $dashChartBarsData
        });

        var myLineChart = new Chart($dashChartLinesCnt, {
            type: 'line',
            data: $dashChartLinesData,
        });
    });

</script>

</body>
</html>